{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Python27\\lib\\site-packages\\pandas\\_libs\\__init__.py:4: RuntimeWarning: numpy.dtype size changed, may indicate binary incompatibility. Expected zd, got zd\n",
      "  from .tslib import iNaT, NaT, Timestamp, Timedelta, OutOfBoundsDatetime\n",
      "C:\\Python27\\lib\\site-packages\\pandas\\__init__.py:26: RuntimeWarning: numpy.dtype size changed, may indicate binary incompatibility. Expected zd, got zd\n",
      "  from pandas._libs import (hashtable as _hashtable,\n",
      "C:\\Python27\\lib\\site-packages\\pandas\\core\\dtypes\\common.py:6: RuntimeWarning: numpy.dtype size changed, may indicate binary incompatibility. Expected zd, got zd\n",
      "  from pandas._libs import algos, lib\n",
      "C:\\Python27\\lib\\site-packages\\pandas\\core\\util\\hashing.py:7: RuntimeWarning: numpy.dtype size changed, may indicate binary incompatibility. Expected zd, got zd\n",
      "  from pandas._libs import hashing, tslib\n",
      "C:\\Python27\\lib\\site-packages\\pandas\\core\\indexes\\base.py:7: RuntimeWarning: numpy.dtype size changed, may indicate binary incompatibility. Expected zd, got zd\n",
      "  from pandas._libs import (lib, index as libindex, tslib as libts,\n",
      "C:\\Python27\\lib\\site-packages\\pandas\\tseries\\offsets.py:21: RuntimeWarning: numpy.dtype size changed, may indicate binary incompatibility. Expected zd, got zd\n",
      "  import pandas._libs.tslibs.offsets as liboffsets\n",
      "C:\\Python27\\lib\\site-packages\\pandas\\core\\ops.py:16: RuntimeWarning: numpy.dtype size changed, may indicate binary incompatibility. Expected zd, got zd\n",
      "  from pandas._libs import algos as libalgos, ops as libops\n",
      "C:\\Python27\\lib\\site-packages\\pandas\\core\\indexes\\interval.py:32: RuntimeWarning: numpy.dtype size changed, may indicate binary incompatibility. Expected zd, got zd\n",
      "  from pandas._libs.interval import (\n",
      "C:\\Python27\\lib\\site-packages\\pandas\\core\\internals.py:14: RuntimeWarning: numpy.dtype size changed, may indicate binary incompatibility. Expected zd, got zd\n",
      "  from pandas._libs import internals as libinternals\n",
      "C:\\Python27\\lib\\site-packages\\pandas\\core\\sparse\\array.py:33: RuntimeWarning: numpy.dtype size changed, may indicate binary incompatibility. Expected zd, got zd\n",
      "  import pandas._libs.sparse as splib\n",
      "C:\\Python27\\lib\\site-packages\\pandas\\core\\window.py:36: RuntimeWarning: numpy.dtype size changed, may indicate binary incompatibility. Expected zd, got zd\n",
      "  import pandas._libs.window as _window\n",
      "C:\\Python27\\lib\\site-packages\\pandas\\core\\groupby\\groupby.py:68: RuntimeWarning: numpy.dtype size changed, may indicate binary incompatibility. Expected zd, got zd\n",
      "  from pandas._libs import (lib, reduction,\n",
      "C:\\Python27\\lib\\site-packages\\pandas\\core\\reshape\\reshape.py:30: RuntimeWarning: numpy.dtype size changed, may indicate binary incompatibility. Expected zd, got zd\n",
      "  from pandas._libs import algos as _algos, reshape as _reshape\n",
      "C:\\Python27\\lib\\site-packages\\pandas\\io\\parsers.py:45: RuntimeWarning: numpy.dtype size changed, may indicate binary incompatibility. Expected zd, got zd\n",
      "  import pandas._libs.parsers as parsers\n",
      "C:\\Python27\\lib\\site-packages\\pandas\\io\\pytables.py:50: RuntimeWarning: numpy.dtype size changed, may indicate binary incompatibility. Expected zd, got zd\n",
      "  from pandas._libs import algos, lib, writers as libwriters\n"
     ]
    }
   ],
   "source": [
    "import pandas as pd\n",
    "import os\n",
    "#import MySQLdb"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# CSV"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# excel"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "      a     b   c\n",
      "0  安宁渠镇  安馨社区 NaN\n",
      "1  安宁渠镇    东村 NaN\n",
      "2  安宁渠镇  保昌堡村 NaN\n",
      "3  安宁渠镇  安泰社区 NaN\n",
      "4  安宁渠镇  宁华社区 NaN\n",
      "5  安宁渠镇  安宁渠村 NaN\n",
      "6  安宁渠镇  北大路村 NaN\n",
      "7  安宁渠镇  东戈壁村 NaN\n"
     ]
    }
   ],
   "source": [
    "# 读文件\n",
    "filePath=r\"C:\\Users\\user\\OneDrive\\myGit\\qidian\\base-data-import\\data_files\"\n",
    "fileName=\"tree.xlsx\"\n",
    "table=pd.read_excel(os.path.join(filePath, fileName),\n",
    "                         sheet_name=0 , skiprows=2,\n",
    "                         names=[\"a\",\"b\",\"c\"], usecols=\"A:M\")\n",
    "print(table)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "      a     b   c     D\n",
      "0  安宁渠镇  安馨社区 NaN  None\n",
      "1  安宁渠镇    东村 NaN  None\n",
      "2  安宁渠镇  保昌堡村 NaN  None\n",
      "3  安宁渠镇  安泰社区 NaN  None\n",
      "4  安宁渠镇  宁华社区 NaN  None\n",
      "5  安宁渠镇  安宁渠村 NaN  None\n",
      "6  安宁渠镇  北大路村 NaN  None\n",
      "7  安宁渠镇  东戈壁村 NaN  None\n"
     ]
    }
   ],
   "source": [
    "# 插入列 在末尾\n",
    "\n",
    "table[\"D\"]=None\n",
    "print(table)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "   name     a     b   c     D\n",
      "0  None  安宁渠镇  安馨社区 NaN  None\n",
      "1  None  安宁渠镇    东村 NaN  None\n",
      "2  None  安宁渠镇  保昌堡村 NaN  None\n",
      "3  None  安宁渠镇  安泰社区 NaN  None\n",
      "4  None  安宁渠镇  宁华社区 NaN  None\n",
      "5  None  安宁渠镇  安宁渠村 NaN  None\n",
      "6  None  安宁渠镇  北大路村 NaN  None\n",
      "7  None  安宁渠镇  东戈壁村 NaN  None\n"
     ]
    }
   ],
   "source": [
    "\n",
    "table.insert(0,\"name\",None)\n",
    "print(table)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "('name', <type 'str'>)\n",
      "('a', <type 'str'>)\n",
      "('b', <type 'str'>)\n",
      "('c', <type 'str'>)\n",
      "('D', <type 'str'>)\n"
     ]
    }
   ],
   "source": [
    "for col in table: \n",
    "    print(col,type(col))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "安宁渠镇\n",
      "安宁渠镇\n",
      "安宁渠镇\n",
      "安宁渠镇\n",
      "安宁渠镇\n",
      "安宁渠镇\n",
      "安宁渠镇\n",
      "安宁渠镇\n"
     ]
    }
   ],
   "source": [
    "#单行输出\n",
    "for i in table.a:\n",
    "    print(i)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "None\n",
      "安宁渠镇\n",
      "安馨社区\n",
      "nan\n",
      "None\n",
      "None\n",
      "安宁渠镇\n",
      "东村\n",
      "nan\n",
      "None\n",
      "None\n",
      "安宁渠镇\n",
      "保昌堡村\n",
      "nan\n",
      "None\n",
      "None\n",
      "安宁渠镇\n",
      "安泰社区\n",
      "nan\n",
      "None\n",
      "None\n",
      "安宁渠镇\n",
      "宁华社区\n",
      "nan\n",
      "None\n",
      "None\n",
      "安宁渠镇\n",
      "安宁渠村\n",
      "nan\n",
      "None\n",
      "None\n",
      "安宁渠镇\n",
      "北大路村\n",
      "nan\n",
      "None\n",
      "None\n",
      "安宁渠镇\n",
      "东戈壁村\n",
      "nan\n",
      "None\n"
     ]
    }
   ],
   "source": [
    "# 多行输出\n",
    "for i in range(0, len(table)):\n",
    "   # print table.iloc[i]['a'], table.iloc[i]['b']\n",
    "    #print(table.iloc[i], type(table.iloc[i]))\n",
    "    for j in table.iloc[i]:\n",
    "        print(j)\n",
    "    "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {},
   "outputs": [
    {
     "ename": "ValueError",
     "evalue": "DataFrame constructor not properly called!",
     "output_type": "error",
     "traceback": [
      "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[0;31mValueError\u001b[0m                                Traceback (most recent call last)",
      "\u001b[0;32m<ipython-input-29-ca79e5bdba15>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[1;32m      2\u001b[0m \u001b[0ma\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m[\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m'a'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'1.2'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'4.2'\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m[\u001b[0m\u001b[0;34m'b'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'70'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'0.03'\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m[\u001b[0m\u001b[0;34m'x'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'5'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'0'\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m      3\u001b[0m \u001b[0mb\u001b[0m\u001b[0;34m=\u001b[0m \u001b[0;34m(\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'a'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'1.2'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'4.2'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m(\u001b[0m\u001b[0;34m'b'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'70'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'0.03'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m(\u001b[0m\u001b[0;34m'x'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'5'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'0'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 4\u001b[0;31m \u001b[0mdf\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mpd\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mDataFrame\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mb\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mcolumns\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m'one'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'two'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'three'\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m      5\u001b[0m \u001b[0;32mprint\u001b[0m \u001b[0mdf\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;32mC:\\Python27\\lib\\site-packages\\pandas\\core\\frame.pyc\u001b[0m in \u001b[0;36m__init__\u001b[0;34m(self, data, index, columns, dtype, copy)\u001b[0m\n\u001b[1;32m    420\u001b[0m                                          dtype=values.dtype, copy=False)\n\u001b[1;32m    421\u001b[0m             \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 422\u001b[0;31m                 \u001b[0;32mraise\u001b[0m \u001b[0mValueError\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'DataFrame constructor not properly called!'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m    423\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    424\u001b[0m         \u001b[0mNDFrame\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m__init__\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmgr\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfastpath\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mTrue\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;31mValueError\u001b[0m: DataFrame constructor not properly called!"
     ]
    }
   ],
   "source": [
    "# list 转 pandas\n",
    "a = [['a', '1.2', '4.2'], ['b', '70', '0.03'], ['x', '5', '0']] \n",
    "b= (('a', '1.2', '4.2'), ('b', '70', '0.03'), ('x', '5', '0')) # 不能用元组\n",
    "df = pd.DataFrame(a, columns=['one', 'two', 'three']) \n",
    "print df "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# SQL"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "metadata": {},
   "outputs": [],
   "source": [
    "def init_db():\n",
    "    conn = None\n",
    "    try:\n",
    "        if conn is None:\n",
    "            # 本地测试\n",
    "            user = 'root'\n",
    "            password = '123456'\n",
    "            host = '127.0.0.1'\n",
    "            port = 3306\n",
    "            db = 'db_patio'\n",
    "            conn = MySQLdb.connect(host=host, user=user, passwd=password, db=db, port=port, charset='utf8')\n",
    "    except Exception as ex:\n",
    "        print ex.__str__()\n",
    "        exit(0)\n",
    "\n",
    "    return conn\n",
    "def execute_select_tomap(db_conn, insert_sql):\n",
    "\n",
    "\n",
    "    if db_conn is None :\n",
    "        return False\n",
    "\n",
    "    cursor = db_conn.cursor()\n",
    "    \n",
    "    print cursor.execute(insert_sql)\n",
    "    results = cursor.fetchall()\n",
    "    #print(results)\n",
    "    #print dict(results)\n",
    "    #idtable=pd.DataFrame(list(results),columns=(\"vehicle_code\",\"vehicle\"))\n",
    "    \n",
    "    return dict(results)\n",
    "def dict_fetch_all(cursor):\n",
    "    desc = cursor.description\n",
    "    return [\n",
    "        dict(zip([col[0] for col in desc], row))\n",
    "        for row in cursor.fetchall()\n",
    "    ]\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "69\n",
      "{u'8581ad72-5c57-4e5f-ab2c-fe07a842f0ba': u'564u9', u'02f9b02b-1f39-42eb-bfc2-4c8cf0273e27': u'8s361', u'040bf5b9-80f5-4435-ade4-17c693266b2d': u'983B3', u'a29d95ae-4281-4a75-bacd-08fdbe7f64c4': u'q', u'a102a5c4-482d-4db8-b07f-a56d1cc24aed': u'.\\u65b0AW7042', u'57ad7b6c-4b6f-4cc9-a953-2737ec687ebb': u'351F0', u'f00f18d4-2adc-418e-8229-8411315b131f': u'\\u65b0ACT219', u'a0302dce-3750-4912-ad10-8f3d40bb06bc': u'1q325', u'a19a4177-d03a-4b64-aeb3-f166f999442b': u'667fy', u'4068c125-0de3-4ab0-bb15-51ec85ddc18f': u'\\u65b0A.969QG', u'0dd94764-0895-4438-9836-0d13aac9caa7': u'22236', u'732c3652-0a9f-4b01-972b-b690f1012567': u'\\u65b0A 6g171', u'2f333d7d-77c9-404d-bdbe-0d8befd3f5c8': u'784y9', u'fe3bb463-0250-4bed-959b-979a8d83ced6': u'6EV97', u'a6bdc883-3129-45ec-a194-b9151c97e004': u'\\u65b0A.YH453', u'1ecd91d5-e48c-42cd-9e78-2c70cc44ffc0': u'254a6', u'6c7eb510-fb28-4deb-953f-b4c6b8ecf1f0': u'42j41', u'09245268-44fa-469d-abf3-1074ee5b575a': u'\\u65b0A.QF129', u'7eaae958-d1a3-4ab5-8443-3749c1400ae2': u'\\u65b0A318mm', u'602cf9ed-bd65-4915-a2ad-7cabfa66940c': u'686Y2', u'ee6068c1-95da-4d14-a76e-d3893589a559': u'\\u65b0A869GL', u'a04739cc-7f7b-4f81-b4aa-4648f91f1bc2': u'TB511', u'1c070bff-4adc-4449-8d91-0d802f2c896f': u'U3843', u'82d8d40f-64d9-477e-8df0-565a85bdd658': u'\\u65b0a2201e', u'9b5fc739-7327-4d31-886e-e75d85160da5': u'333SB', u'f6420811-f380-4d3f-860b-06f210593b38': u'\\u65b0A1BV19', u'0f1ee961-fa07-4198-9453-14f145581bc2': u'\\u65b0A 6985C', u'902140c6-c4f5-41ae-8a92-0ca7a5a72f73': u'\\u8d1b18Q649', u'9a3d33d4-db8a-4e1e-8cc3-2a23615e020a': u'\\u65b0A UG866', u'9b0cb4ec-ad12-4d42-842d-173445cf73e7': u'\\u65b0A81A00', u'0758956b-fc41-4ece-a9ce-cbbac0addaf6': u'\\u65b0A   CT069', u'e2924f26-2113-4dbe-a529-8f72510f92e2': u'\\u65b0A 5FT97', u'68204fb1-704c-467a-b73b-8d512c4d53ba': u'\\u65b0A60T76', u'5c27989a-06e3-443b-905b-959c6cc36004': u'\\u65b0ATC898', u'f5d2c658-09c8-4ab7-908c-6621f8aba68a': u'\\u65b0A   5H896', u'5889e94e-f375-418d-aae5-e0a03ebd7827': u'\\u65b0AYT099', u'3f98eae7-9c7a-421a-8645-0d3623cf5a91': u'702zm', u'042635c9-e97b-4220-a614-dac90cb67d0e': u'0N272', u'b06d8f73-612b-499c-8c3d-58a994481881': u'3EY56', u'c53dcf18-44a0-4a29-9097-96a54c3676d5': u'\\u65b0AIDU09', u'a7e69ef3-013f-4928-958c-8c3c01573bb6': u'9x048', u'e1795774-fec3-4ee4-ae62-15c4084ca5f8': u'\\u65b0B4F632', u'd314f663-bceb-49c2-9cab-2480d058d3de': u'40k06', u'4adeb55c-d338-4234-b894-d40c494f5e6d': u'\\u65b0A6CG52', u'05f6003b-f7a1-4705-ab19-366ceecf159d': u'3786h', u'265058a2-fb7a-49c5-9c12-634859791675': u'8153d', u'fe52a0d0-dc79-405f-8428-8325e1db1335': u'\\u65b0A288HA', u'35fc7bb4-a197-4aeb-9cac-a8ce2cb6e443': u'\\u65b0A.9f\\n\\u65b0a.9fp85', u'858e9878-2d76-4b91-a800-8859b49a4a52': u'91E57', u'b8b8e1fe-b794-4b74-ad65-a09fdc204f9c': u'\\u65b0AN3167', u'f8df2681-6f08-4c4e-b19d-0bce5f235725': u'JM010', u'28f240e4-976d-4ac8-af93-a57bcde6f9a8': u'\\u65b0A S3602', u'4ca347b2-3009-4e6a-92a5-e706545d6bb4': u'\\u65b0AQT101', u'a7bb2a26-e7f4-4e27-9bf2-b1b338e5ed48': u'\\u65b0A  7JB 98', u'1ac61aa3-1db5-4e4f-a2e2-d2503e4427e0': u'GR562', u'45e92c3f-c6bd-4228-a459-9ed241a22cc1': u'8CP63', u'3f4c8c3e-2172-4499-b535-09c6a3a007c1': u'31018', u'd3fc4bb1-eeb6-4ab5-841d-70462f7cd138': u'\\u65b0A.186QC', u'698e9c57-7f15-46d6-bb2b-91e69e5a7db9': u'89s21', u'21c142d2-c74b-4f7e-be2a-286987e3dd1a': u'\\u65b0A 09k03', u'12a20523-1fdf-4087-a960-5f7fa2495695': u'\\u65b0A YJ179', u'f29d18bc-f38d-4ef2-a746-9bcde2e3db7f': u'113G ', u'c0f8b70c-68f9-4959-a644-b75c8175abde': u'\\u65b0A98750', u'e8318bbb-445a-42c7-91fd-9bd5d13af124': u'MK005', u'ece82159-ad4b-48eb-b3ec-2facdca26c12': u'2FQ95', u'd2700a91-e9f4-4b97-b34c-1c4cee039b62': u'93a98', u'34db5002-e01c-4960-a1cd-d4a688a41bd1': u'64u55', u'7eb2b5c1-11ed-48d7-aee3-c45498120edb': u'\\u65b0ANR676', u'9d4b374c-6caf-4ce9-8757-9e9bdb7cde78': u'\\u65b0A.42r69'}\n",
      "                            vehicle_code          vehicle\n",
      "0   68204fb1-704c-467a-b73b-8d512c4d53ba          新A60T76\n",
      "1   5889e94e-f375-418d-aae5-e0a03ebd7827          新AYT099\n",
      "2   f00f18d4-2adc-418e-8229-8411315b131f          新ACT219\n",
      "3   f6420811-f380-4d3f-860b-06f210593b38          新A1BV19\n",
      "4   e1795774-fec3-4ee4-ae62-15c4084ca5f8          新B4F632\n",
      "5   c53dcf18-44a0-4a29-9097-96a54c3676d5          新AIDU09\n",
      "6   4ca347b2-3009-4e6a-92a5-e706545d6bb4          新AQT101\n",
      "7   b8b8e1fe-b794-4b74-ad65-a09fdc204f9c          新AN3167\n",
      "8   7eb2b5c1-11ed-48d7-aee3-c45498120edb          新ANR676\n",
      "9   698e9c57-7f15-46d6-bb2b-91e69e5a7db9            89s21\n",
      "10  4068c125-0de3-4ab0-bb15-51ec85ddc18f         新A.969QG\n",
      "11  a6bdc883-3129-45ec-a194-b9151c97e004         新A.YH453\n",
      "12  09245268-44fa-469d-abf3-1074ee5b575a         新A.QF129\n",
      "13  ee6068c1-95da-4d14-a76e-d3893589a559          新A869GL\n",
      "14  c0f8b70c-68f9-4959-a644-b75c8175abde          新A98750\n",
      "15  d3fc4bb1-eeb6-4ab5-841d-70462f7cd138         新A.186QC\n",
      "16  fe52a0d0-dc79-405f-8428-8325e1db1335          新A288HA\n",
      "17  5c27989a-06e3-443b-905b-959c6cc36004          新ATC898\n",
      "18  4adeb55c-d338-4234-b894-d40c494f5e6d          新A6CG52\n",
      "19  0f1ee961-fa07-4198-9453-14f145581bc2         新A 6985C\n",
      "20  e2924f26-2113-4dbe-a529-8f72510f92e2         新A 5FT97\n",
      "21  9a3d33d4-db8a-4e1e-8cc3-2a23615e020a         新A UG866\n",
      "22  9b0cb4ec-ad12-4d42-842d-173445cf73e7          新A81A00\n",
      "23  21c142d2-c74b-4f7e-be2a-286987e3dd1a         新A 09k03\n",
      "24  28f240e4-976d-4ac8-af93-a57bcde6f9a8         新A S3602\n",
      "25  9d4b374c-6caf-4ce9-8757-9e9bdb7cde78         新A.42r69\n",
      "26  12a20523-1fdf-4087-a960-5f7fa2495695         新A YJ179\n",
      "27  7eaae958-d1a3-4ab5-8443-3749c1400ae2          新A318mm\n",
      "28  0758956b-fc41-4ece-a9ce-cbbac0addaf6       新A   CT069\n",
      "29  35fc7bb4-a197-4aeb-9cac-a8ce2cb6e443  新A.9f\\n新a.9fp85\n",
      "..                                   ...              ...\n",
      "39  9b5fc739-7327-4d31-886e-e75d85160da5            333SB\n",
      "40  ece82159-ad4b-48eb-b3ec-2facdca26c12            2FQ95\n",
      "41  d2700a91-e9f4-4b97-b34c-1c4cee039b62            93a98\n",
      "42  45e92c3f-c6bd-4228-a459-9ed241a22cc1            8CP63\n",
      "43  1ac61aa3-1db5-4e4f-a2e2-d2503e4427e0            GR562\n",
      "44  040bf5b9-80f5-4435-ade4-17c693266b2d            983B3\n",
      "45  a19a4177-d03a-4b64-aeb3-f166f999442b            667fy\n",
      "46  2f333d7d-77c9-404d-bdbe-0d8befd3f5c8            784y9\n",
      "47  602cf9ed-bd65-4915-a2ad-7cabfa66940c            686Y2\n",
      "48  f29d18bc-f38d-4ef2-a746-9bcde2e3db7f            113G \n",
      "49  a7e69ef3-013f-4928-958c-8c3c01573bb6            9x048\n",
      "50  3f4c8c3e-2172-4499-b535-09c6a3a007c1            31018\n",
      "51  0dd94764-0895-4438-9836-0d13aac9caa7            22236\n",
      "52  8581ad72-5c57-4e5f-ab2c-fe07a842f0ba            564u9\n",
      "53  a0302dce-3750-4912-ad10-8f3d40bb06bc            1q325\n",
      "54  858e9878-2d76-4b91-a800-8859b49a4a52            91E57\n",
      "55  a04739cc-7f7b-4f81-b4aa-4648f91f1bc2            TB511\n",
      "56  d314f663-bceb-49c2-9cab-2480d058d3de            40k06\n",
      "57  b06d8f73-612b-499c-8c3d-58a994481881            3EY56\n",
      "58  1ecd91d5-e48c-42cd-9e78-2c70cc44ffc0            254a6\n",
      "59  05f6003b-f7a1-4705-ab19-366ceecf159d            3786h\n",
      "60  e8318bbb-445a-42c7-91fd-9bd5d13af124            MK005\n",
      "61  f8df2681-6f08-4c4e-b19d-0bce5f235725            JM010\n",
      "62  34db5002-e01c-4960-a1cd-d4a688a41bd1            64u55\n",
      "63  02f9b02b-1f39-42eb-bfc2-4c8cf0273e27            8s361\n",
      "64  a29d95ae-4281-4a75-bacd-08fdbe7f64c4                q\n",
      "65  265058a2-fb7a-49c5-9c12-634859791675            8153d\n",
      "66  fe3bb463-0250-4bed-959b-979a8d83ced6            6EV97\n",
      "67  6c7eb510-fb28-4deb-953f-b4c6b8ecf1f0            42j41\n",
      "68  3f98eae7-9c7a-421a-8645-0d3623cf5a91            702zm\n",
      "\n",
      "[69 rows x 2 columns]\n"
     ]
    }
   ],
   "source": [
    "DB_CONN = init_db()\n",
    "sql=exe_select_id_sql=\"\"\"SELECT\n",
    "t_vehicle_copy.`code`,\n",
    "t_vehicle_copy.vehicle_licence\n",
    "FROM.\n",
    "t_vehicle_copy\n",
    "\"\"\"\n",
    "r=execute_insert(DB_CONN,sql.encode(\"utf-8\"))\n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.12"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
